package com.rtx.edi.platform.express.auth.service.impl;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rtx.edi.model.express.auth.po.PlExpressSubscription;
import com.rtx.edi.platform.express.auth.mapper.PlExpressSubscriptionMapper;
import com.rtx.edi.platform.express.auth.service.PlExpressSubscriptionService;

@Service
public class PlExpressSubscriptionServiceImpl extends ServiceImpl<PlExpressSubscriptionMapper,PlExpressSubscription> implements PlExpressSubscriptionService {

	
	@Override
	public void selectByPage(Page<PlExpressSubscription> pageParam, PlExpressSubscription vo) {
		LambdaQueryWrapper<PlExpressSubscription> query = Wrappers.lambdaQuery();
		query.eq(PlExpressSubscription::getDeleteflag, "0");
		if(vo!=null) {
			query.eq(vo.getSalesp()!=null, PlExpressSubscription::getSalesp, vo.getSalesp())
			.eq(vo.getCptype()!=null,PlExpressSubscription::getCptype,vo.getCptype())
			.eq(vo.getCpcode()!=null, PlExpressSubscription::getCpcode, vo.getCpcode())
			.eq(vo.getBranchcode()!=null, PlExpressSubscription::getBranchcode, vo.getBranchcode())
			.like(vo.getBranchname()!=null, PlExpressSubscription::getBranchname, vo.getBranchname())
			;
			
		}
		baseMapper.selectPage(pageParam,query);
		
	}

	@Override
	public boolean addPlExpressSubscription(PlExpressSubscription vo) {
		
		return baseMapper.insertPlExpressSubscription(vo)==1;
	}


}
